﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class WorldMapBaseLayerDiscreteObjectLayerWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(WorldMapBase.Layer.DiscreteObjectLayer);
			Utils.BeginObjectRegister(type, L, translator, 0, 4, 1, 1);
			
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetListener", _m_SetListener);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddObject", _m_AddObject);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "UpdateObject", _m_UpdateObject);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "RemoveObject", _m_RemoveObject);
			
			
			Utils.RegisterFunc(L, Utils.GETTER_IDX, "debug", _g_get_debug);
            
			Utils.RegisterFunc(L, Utils.SETTER_IDX, "debug", _s_set_debug);
            
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0);
			
			
            
			
			
			
            Utils.RegisterFunc(L, Utils.CLS_IDX, "New", __CreateInstanceNew);
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 3 && translator.Assignable<WorldMapBase.Layer.IDiscreteObjectLayerListener>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
				{
					WorldMapBase.Layer.IDiscreteObjectLayerListener _listener = (WorldMapBase.Layer.IDiscreteObjectLayerListener)translator.GetObject(L, 2, typeof(WorldMapBase.Layer.IDiscreteObjectLayerListener));
					int _gridSize = LuaAPI.xlua_tointeger(L, 3);
					
					var gen_ret = new WorldMapBase.Layer.DiscreteObjectLayer(_listener, _gridSize);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				if(LuaAPI.lua_gettop(L) == 4 && translator.Assignable<WorldMapBase.Layer.IDiscreteObjectLayerListener>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))
				{
					WorldMapBase.Layer.IDiscreteObjectLayerListener _listener = (WorldMapBase.Layer.IDiscreteObjectLayerListener)translator.GetObject(L, 2, typeof(WorldMapBase.Layer.IDiscreteObjectLayerListener));
					int _gridWidth = LuaAPI.xlua_tointeger(L, 3);
					int _gridHeight = LuaAPI.xlua_tointeger(L, 4);
					
					var gen_ret = new WorldMapBase.Layer.DiscreteObjectLayer(_listener, _gridWidth, _gridHeight);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				if(LuaAPI.lua_gettop(L) == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
				{
					int _gridSize = LuaAPI.xlua_tointeger(L, 2);
					
					var gen_ret = new WorldMapBase.Layer.DiscreteObjectLayer(_gridSize);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				if(LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
				{
					int _gridWidth = LuaAPI.xlua_tointeger(L, 2);
					int _gridHeight = LuaAPI.xlua_tointeger(L, 3);
					
					var gen_ret = new WorldMapBase.Layer.DiscreteObjectLayer(_gridWidth, _gridHeight);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to WorldMapBase.Layer.DiscreteObjectLayer constructor!");
            
        }

        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstanceNew(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 2 && translator.Assignable<WorldMapBase.Layer.IDiscreteObjectLayerListener>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
				{
					WorldMapBase.Layer.IDiscreteObjectLayerListener _listener = (WorldMapBase.Layer.IDiscreteObjectLayerListener)translator.GetObject(L, 1, typeof(WorldMapBase.Layer.IDiscreteObjectLayerListener));
					int _gridSize = LuaAPI.xlua_tointeger(L, 2);
					
					var gen_ret = new WorldMapBase.Layer.DiscreteObjectLayer(_listener, _gridSize);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				if(LuaAPI.lua_gettop(L) == 3 && translator.Assignable<WorldMapBase.Layer.IDiscreteObjectLayerListener>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
				{
					WorldMapBase.Layer.IDiscreteObjectLayerListener _listener = (WorldMapBase.Layer.IDiscreteObjectLayerListener)translator.GetObject(L, 1, typeof(WorldMapBase.Layer.IDiscreteObjectLayerListener));
					int _gridWidth = LuaAPI.xlua_tointeger(L, 2);
					int _gridHeight = LuaAPI.xlua_tointeger(L, 3);
					
					var gen_ret = new WorldMapBase.Layer.DiscreteObjectLayer(_listener, _gridWidth, _gridHeight);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				if(LuaAPI.lua_gettop(L) == 1 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1))
				{
					int _gridSize = LuaAPI.xlua_tointeger(L, 1);
					
					var gen_ret = new WorldMapBase.Layer.DiscreteObjectLayer(_gridSize);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				if(LuaAPI.lua_gettop(L) == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
				{
					int _gridWidth = LuaAPI.xlua_tointeger(L, 1);
					int _gridHeight = LuaAPI.xlua_tointeger(L, 2);
					
					var gen_ret = new WorldMapBase.Layer.DiscreteObjectLayer(_gridWidth, _gridHeight);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to WorldMapBase.Layer.DiscreteObjectLayer constructor!");
            
        }

        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_SetListener(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WorldMapBase.Layer.DiscreteObjectLayer gen_to_be_invoked = (WorldMapBase.Layer.DiscreteObjectLayer)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    WorldMapBase.Layer.IDiscreteObjectLayerListener _listener = (WorldMapBase.Layer.IDiscreteObjectLayerListener)translator.GetObject(L, 2, typeof(WorldMapBase.Layer.IDiscreteObjectLayerListener));
                    
                    gen_to_be_invoked.SetListener( _listener );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_AddObject(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WorldMapBase.Layer.DiscreteObjectLayer gen_to_be_invoked = (WorldMapBase.Layer.DiscreteObjectLayer)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    string _id = LuaAPI.lua_tostring(L, 2);
                    float _x = (float)LuaAPI.lua_tonumber(L, 3);
                    float _y = (float)LuaAPI.lua_tonumber(L, 4);
                    
                        var gen_ret = gen_to_be_invoked.AddObject( _id, _x, _y );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_UpdateObject(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WorldMapBase.Layer.DiscreteObjectLayer gen_to_be_invoked = (WorldMapBase.Layer.DiscreteObjectLayer)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    string _id = LuaAPI.lua_tostring(L, 2);
                    float _x = (float)LuaAPI.lua_tonumber(L, 3);
                    float _y = (float)LuaAPI.lua_tonumber(L, 4);
                    
                        var gen_ret = gen_to_be_invoked.UpdateObject( _id, _x, _y );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_RemoveObject(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WorldMapBase.Layer.DiscreteObjectLayer gen_to_be_invoked = (WorldMapBase.Layer.DiscreteObjectLayer)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    string _id = LuaAPI.lua_tostring(L, 2);
                    
                        var gen_ret = gen_to_be_invoked.RemoveObject( _id );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_debug(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                WorldMapBase.Layer.DiscreteObjectLayer gen_to_be_invoked = (WorldMapBase.Layer.DiscreteObjectLayer)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushboolean(L, gen_to_be_invoked.debug);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_debug(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                WorldMapBase.Layer.DiscreteObjectLayer gen_to_be_invoked = (WorldMapBase.Layer.DiscreteObjectLayer)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.debug = LuaAPI.lua_toboolean(L, 2);
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
		
		
		
		
    }
}
